<?php
    @include_once("conn.php");
    // @header( "Access-Control-Allow-origin:*");//使别人跨域

    $user = $_POST["user"];
    $pwd = $_POST["pwd"];

    if(!($user&&$pwd)){
        argErr();
    }

    $search = "SELECT * from `userinfo` WHERE user = '$user'";

    $result = mysqli_query($conn,$search);  
    
    $item = mysqli_fetch_assoc($result);

    $obj = array();
    if($item){
        if($pwd == $item["pwd"]){
            $obj["status"] = true;
            $obj["detail"] = "登录成功";
            
        }else{
            $obj["status"] = false;
            $obj["detail"] = "密码错误";
        }
    }else{
        $obj["status"] = false;
        $obj["detail"] = "登录失败,账号或密码错误";
        $obj["sql"] = $search;
    }
    echo json_encode($obj);

?>